using Framework;
using Common;
using UnityEngine.UI;
using UnityEngine;

public class AppView : View
{
    private HomePage homePage;

    protected override void Init()
    {
        transform.GetButton("Btn_Home").onClick.AddListener(OnShowHomePage);
        transform.Find("Version").GetComponent<Text>().text = Application.version;

        homePage = transform.Find("HomePage").GetComponent<HomePage>();
        ConnectView<HomePage>(homePage.transform);
        homePage.Show();
    }

    private void OnShowHomePage()
    {
        TriggerModuleEvent(GlobalEvent.LoadScene, StaticData.HomeScene);
    }

    public void LoadScene(bool isShowHomePage)
    {
        if (isShowHomePage)
            homePage.Show();
        else
            homePage.Hide();
    }
}
